﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace InForTheCloud.OAuthLite.Tests
{
    [TestClass]
    public class OAuthBaseStringBuilderTest
    {
        [TestMethod]
        public void CreateInstance()
        {
            var bld = new OAuthBaseStringBuilder();
        }

        [TestMethod]
        public void RFCExampleTest ()
        {
            var expected  ="GET&http%3A%2F%2Fexample.com%2Frequest&a2%3Dr%2520b%26a3%3D2%2520q%26a3%3Da%26b5%3D%253D%25253D%26c%2540%3D%26c2%3D%26oauth_consumer_key%3D9djdj82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7";
            var bld = new OAuthBaseStringBuilder()
                .http()
                .get()
                .host("example.com")
                .path("/request")
                .query("b5", "=%3D")
                .query("a3", "a")
                .query("c@", "")
                .query("a2", "r b")
                .oauth_consumer_key("9djdj82h48djs9d2")
                .oauth_token("kkk9d7dh3k39sjv7")
                .oauth_signature_method_HMAC_SHA1()
                .oauth_timestamp(137131201)
                .oauth_nonce("7d8f3e4a")
                .query("c2", "")
                .query("a3", "2 q");

            Assert.AreEqual(expected, bld.ToString());
        }

   }
}
